<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <header th:replace="header::html"></header>
</head>
<body>
<form class="layui-form layui-form-pane" action="/income/addIncome" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">in_title</label>
        <div class="layui-input-block">
            <input type="text" name="inTitle" required  lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">in_name</label>
        <div class="layui-input-block">
            <input type="text" name="inName" required lay-verify="required" placeholder="请输入in_name" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">in_money</label>
        <div class="layui-input-block">
            <input type="text" name="inMoney" required lay-verify="required" placeholder="请输入in_money" autocomplete="off" class="layui-input">
        </div>
    </div>
<!--    <div class="layui-form-item">
        <label class="layui-form-label">in_way</label>
        <div class="layui-input-block">
            <input type="text" name="inWay" required lay-verify="required" placeholder="请输入in_money" autocomplete="off" class="layui-input">
        </div>
    </div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">支付方式</label>
        <div class="layui-input-block">
            <select name="inWay" lay-verify="">
                <option value="">请选择一个支付方式</option>
                <option value="微信">微信</option>
                <option value="支付宝">支付宝</option>
                <option value="数字货币">数字货币</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">in_remarks</label>
        <div class="layui-input-block">
            <input type="text" name="inRemarks" required lay-verify="required" placeholder="请输入in_money" autocomplete="off" class="layui-input">
        </div>
    </div>
<!--    <div class="layui-form-item">
        <label class="layui-form-label">in_time</label>
        <div class="layui-input-block">
            <input type="text" name="inTime" required lay-verify="required" placeholder="请输入in_money" autocomplete="off" class="layui-input">
        </div>
    </div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">时间</label>
        <div class="layui-input-block">
            <input type="text" name="inTime" id="time1" required lay-verify="required" placeholder="请选择时间" autocomplete="off" class="layui-input">
        </div>
    </div>
 <!--   <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="role" lay-verify="">
                <option value="">请选择一个角色</option>
                <option value="系统管理员">系统管理员</option>
                <option value="舍长">舍长</option>
                <option value="舍员">舍员</option>
            </select>
        </div>
    </div>-->
   <!-- <div class="layui-form-item">
        <label class="layui-form-label">编号</label>
        <div class="layui-input-block">
            <input type="text" name="number" required lay-verify="required" placeholder="请输入编号" autocomplete="off" class="layui-input">
        </div>
    </div>-->
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            $ = layui.jquery;
            $.ajax({
                url:"/income/addIncome",    //数据接口
                type:"POST",            //提交方式
                contentType: "application/json; charset=utf-8",        //定义网络文件的类型和网页的编码，决定浏览器将以什么形式、什么编码读取这个文件
                data:JSON.stringify(data.field),
                dataType:'json',        //数据类型
                success:function(result){
                    layer.alert("添加成功", {icon: 6},function (index1) {
                        layer.close(index1);
                        location.reload()       //当前页面刷新
                        parent.location.reload();   //父级页面刷新
                        var index = parent.layer.getFrameIndex(window.name);    //获取当前页面的索引值(被父级索引的值)
                        parent.layer.close(index);  //关闭子页面
                    });
                }
            })
            return false;
        });
    });

</script>
<script src="/static/build/layui.js"></script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#time1' //指定元素

        });
    });
</script>
</body>
</html>